<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!--新增入库弹窗 start-->
<div class="body-main" id="add">
    <div class="finan-panel">
        <div class="finan-tit">
            <b>资质信息</b>
        </div>
        <div class="panel-table">
            <form id="qualificationForm">
                <table class="layui-table table-info">
                    <tbody>
                    <tr>
                        <th><span class="required">资质类型</span></th>
                        <td>
                            <select class="select-style" name="certificateType" data-type="${qualification.certificateType}">
                                <option value="">请选择</option>
                                <c:forEach items="${typeList}" var="cerType">
                                    <option value="${cerType.id}" data-id="${cerType.id}" ${qualification.certificateType==cerType.certificateName?'selected':''}>${cerType.certificateName}</option>
                                </c:forEach>
                            </select>
                        </td>
                        <th><span class="required">资质名称</span></th>
                        <td>
                            <select class="select-style" name="certificateName" id="certificateName" multiple="multiple" onchange="checkAptitudeSpecialty('#qualificationForm #certificateName')">
                                <c:if test="${qualification.id!=null && qualification.id!=''}">
                                    <c:forEach items="${nameList}" var="name">
                                        <option value="${name.id}" data-id="${name.id}" value="${name.id}" data-level="${name.certificateLevel}">${name.certificateName}</option>
                                    </c:forEach>
                                </c:if>
                                <c:if test="${qualification.id==null or qualification.id==''}">
                                    <option value="">请选择</option>
                                </c:if>
                            </select>
                        </td>
                        <th><span class="required">资质等级</span></th>
                        <td>
                            <select class="select-style" name="certificateLevel" id="certificateLevel">
                                <option value="">请选择</option>
                                <c:forEach items="${certificateLevels}" var="level">
                                    <option value="${level.code}" <c:if test="${qualification.certificateLevel eq level.code}">selected</c:if>>${level.name}</option>
                                </c:forEach>
                            </select>
                        </td>

                        <th><span class="required">适用范围</span></th>
                        <td>
                            <select class="select-style" name="applicationScope">
                                <option value="">请选择</option>
                                <c:forEach items="${applicationScopes}" var="scope">
                                    <option value="${scope.code}" ${qualification.applicationScope eq scope.code?'selected':''}>${scope.name}</option>
                                </c:forEach>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th><span class="required">资质所属企业</span></th>
                        <td>
                            <input type="text" class="input-style" name="companyName" value="${qualification.companyName}">
                        </td>
                        <th><span class="required">资质编号</span></th>
                        <td>
                            <input type="text" class="input-style" name="certificateNo" value="${qualification.certificateNo}">
                        </td>
                        <th><span class="required">成本价格</span></th>
                        <td>
                            <input type="text" class="input-style" name="receiptPrice" value="${qualification.receiptPrice}" onkeyup="restrictInputLength(this,8)">
                        </td>
                        <th><span class="required">资质过期时间</span></th>
                        <td>
                            <input type="text" class="input-style Wdate" name="certificateExpiryTime" value="<fmt:formatDate value="${qualification.certificateExpiryTime}" pattern="yyyy-MM-dd"/>" autocomplete="off" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-%d'})">
                        </td>
                    </tr>
                    <tr>
                        <th><span class="required">地区</span></th>
                        <td>
                            <div class="bus-plugIn" id="certificateArea">
                                <input type="hidden" name="certificateAreaId" class="plug-in-msg"/>
                                <input type="hidden" name="certificateArea" value="${certificateArea}" class="plug-in-code"/>
                                <input type="text" readonly placeholder="请选择" name="areaName" class="chose-plugIn layui-input" id="certificateAreaChange" value="<c:if test="${qualification.areaProvince!=null and qualification.areaProvince!=''}">${qualification.areaProvince}/</c:if>${qualification.certificateArea}">
                                <div class="bus-picker">
                                    <div class="bus-picker-tab">
                                        <a href="javascript:void(0);" class="active">请选择</a>
                                    </div>
                                    <div class="bus-picker-content"></div>
                                </div>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <input hidden value="${qualificationId}" name="qualificationId">
                <input hidden value="${empty qualification.baseId ? qualificationId : qualification.baseId}" name="certificateId">
                <input hidden value="${saveType}" name="saveType">
            </form>
        </div>
    </div>
    <div class="finan-panel">
        <div class="finan-tit">
            <b>附件信息</b>
        </div>
        <div class="panel-main">
            <ul class="data-warp">
                <li>
                    <a href="javascript:void(0)" class="upload-button" id="upload"></a>
                    <input class="layui-upload-file" type="file" name="file" multiple="" is-remove="1" load-file="1" id="annexUpload" data-type="credential" data-fileid="${empty qualification.baseId ? qualificationId : qualification.baseId}">
                    <p>上传附件</p>
                </li>
            </ul>
        </div>
    </div>
</div>
<!--新增入库弹窗 end-->
<%--<script src="${rootUrl}/static/js/zzsc/common/verificationToolverificationTool.js?v=${version}" type="text/javascript" charset="utf-8"></script>--%>
<script src="${pageContext.request.contextPath}/static/js/zzsc/credential/qualification/edit.js"></script>
<%--<script src="${rootUrl}/static/js/zzsc/credential/credentailCommon/credentailCommon.js?v=${version}"></script>--%>
<script src="${pageContext.request.contextPath}/static/js/zzsc/common/files/annex.js"></script>
<script>
    $(function () {
        //异步加载
        Plug.plug_ins(
            "get",
            "${cmsBaseUrl}/api/cms/tree_book/v1/get_tree_book_list.do?code=2147483647&type=2&level=1",
            "#certificateArea",
            '请选择地区',
            function () {
            },
            true, '2147483647'
        );
        $("#qualificationForm #certificateName").select2({
            placeholder: "请选择",
            width: "190px",
            language: "zh-CN"
        });
        var names = '${changeNames}';
        var objVals = names.split(",");
        $("#qualificationForm #certificateName").val(objVals).trigger("change");
    })
</script>